<%@ page pageEncoding="UTF-8"%>
<%@include file='../../common/common.jsp' %>
<%@include file="../../common/jsVersion.jsp"%>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>分配管理</title>
  </head>
  <script type="text/javascript">
  	var contextPath = '${contextPath}';
  	var projectId='${projectId}';
  	var dfpProjectId='${dfpProjectId}';
  </script>
<body>
    <div class="main-content"  id="fpglProjectIndex">
        <div class="nav-list-title">
            <ul class="list-title-crumbs">
                <li>
                  <i class="fa fa-map-marker mainTone"></i>
                  <a class="text">客户管理</a>
                  <i class="fa fa-angle-right"></i>
                </li>
                <li><a class="mainTone">分配管理</a></li>
            </ul>
        </div>
        <ul v-if="permission.callCustomerShow" class="nav-list-cell bor-t bor-l bor-r">
          <li class="active" ><a href="javascript:;">已分配</a><span class="col">|</span></li>
          <li><a href="javascript:;">待分配</a></li> 
        </ul> 
        <ul class="info-details-list">
            <li class="details-list-li active">
                <div class="item-info-surround"  >
                    <h3 class="item-title">查询条件</h3>
                    <ul class="exhibition-list">
                        <li class="col-lg-4 col-md-6">
                            <div class="currency-template-query">
                                <label class="template-title"><span class="required">*</span>项目名称:</label>
                                <div class="template-controls">
                                    <select class="form-control" v-model="params.projectId" id="projectId" >
									    <option value="">请选择</option>
										<option v-for="project in projectList" v-bind:value="project.id">{{project.projectName}}</option>
									</select>
                                </div>
                            </div>
                        </li>
                        <li class="col-lg-4 col-md-6">
                            <div class="currency-template-query">
                                <label class="template-title">新归属人:</label>
                                <div class="template-controls">
                                    <select class="form-control" v-model="params.assignPerson" id="assignPerson">
                                    	<option value="">请选择</option>
										<option v-for="(row,index) in assignPersonList" v-bind:value="row.id">{{row.userName}}</option>
									</select>
                                </div>
                            </div>
                        </li>
                        <li class="col-lg-4 col-md-6">
                            <div class="currency-template-query">
                                <label class="template-title">分配人:</label>
                                <div class="template-controls">
                                    <select class="form-control" v-model="params.createUserId" id="createUserId">
                                    	<option value="">请选择</option>
										<option v-for="createUserIdEntity in createUserIdList" v-bind:value="createUserIdEntity.id">{{createUserIdEntity.userName}}</option>
									</select>
                                </div>
                            </div>
                        </li>
                        <li class="col-lg-4 col-md-6">
                            <div class="currency-template-query">
                                <label class="template-title">分配期间:</label>
                                <div class="template-controls">
                                    <div class="time-selector">
                                      <div class="time-selector-list date form_datetime">
                                        <input id="startTimeStart" type="text" class="form-control" readonly="readonly">
                                            <span class="timeIcon add-on"><i class="fa fa-calendar"></i></span>
                                      </div>
                                      <div class="interval-span">-</div>
                                      <div class="time-selector-list date form_datetime">
                                        <input id="startTimeEnd" type="text" class="form-control" readonly="readonly">
                                        <span class="timeIcon add-on"><i class="fa fa-calendar"></i></span>
                                      </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li class="col-lg-8 col-md-12">
                            <div class="currency-template-query">
                                <label class="template-title">客户状态:</label>
                                <div class="template-controls">
                                    <ul class="checkbox">
                                        <li v-for="(row,index) in customerStatusList">
								   			<label><input type="checkbox" id="customerStatus" name="customerStatus" v-model="params.customerStatusArray"   v-bind:value="row.key">{{row.value}}</label>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </li>
                        <li class="col-sm-12">
                            <div class="currency-template-query">
                                <label class="template-title">客户等级:</label>
                                <div class="template-controls">
                                    <ul class="checkbox">
                                        <li v-for="(row,index) in intentionLevelList">
										   	<label><input type="checkbox" name="intentionLevel" v-model="params.intentionLevelArray"  v-bind:value="row.key">{{row.value}}</label>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </li>
                        <li class="col-sm-12">
                            <div class="currency-template-query">
                                <label class="template-title">客户来源:</label>
                                <div class="template-controls">
                                    <ul class="checkbox">
                                        <li v-for="(row,index) in customerOriginList">
									      <label><input type="checkbox"  name="customerOrigin" v-model="params.customerOriginArray"  v-bind:value="row.id">{{row.codeName}}</label>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </li>
                    </ul>
                    <div class="query-operation">
                        <div class="fr">
                            <button v-if="permission.query" id='searchBtn' class="btn"  v-on:click="queryList">查询</button>
                            <button id='clearBtn' class="btn" v-on:click="clearForm">清空</button>
                        </div>
                    </div>
                </div>
                <div class="table-responsive bor-l bor-r">
                    <table id="yifenpeiList" class="table table-striped table-bordered min-width-1150">
                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>客户名称</th>
                                <th>联系电话</th>
                                <th>性别</th>
                                <!-- <th>生日</th> -->
                                <th>意向等级</th>
                                <th>客户状态</th>
                                <th>处理状态</th>
                                <th>处理结果</th>
                                <th>处理时间</th>
                                <th>新归属人</th>
                                <th>分配人</th>
                                <th>分配时间</th>
                                <!-- <th>操作</th> -->
                            </tr>
                        </thead>
                        <tbody>
                        	<tr v-for="(row,index) in ppList">
                        		<td>{{index+1}}</td>
                        		<td>{{row.customerName }}</td>
                        		<td>{{row.customerPhone }}</td>
                        		<td>{{row.customerSexName }}</td>
                        		<td>{{row.intentionLevelName }}</td>
                        		<td>{{row.customerStatusName }}</td>
                        		<td>{{row.processStatusName }}</td>
                        		<td>{{row.processResult }}</td>
                        		<td>{{row.processTime  | moment }}</td>
                        		<td>{{row.assignPersonName }}</td>
                        		<td>{{row.createUserName }}</td>
                        		<td>{{row.distributionTime  | moment }}</td>
                        		<!-- <td></td> -->
                        	</tr>
                        </tbody>
                    </table>
			</div>
			<div id="pagination"></div>
            </li>
            <li  class="details-list-li">
                <div class="item-info-surround">
                    <h3 class="item-title">查询条件</h3>
                    <ul class="exhibition-list">
                        <li class="col-sm-12">
                            <div class="currency-template-query">
                                <label class="template-title"><span class="required">*</span>项目名称:</label>
                                <div class="template-controls">
                                    <select class="form-control" v-model="params1.wfpProjectId" id="wfpProjectId" >
									    <option value="">全部</option>
										<option v-for="project in projectList" v-bind:value="project.id">{{project.projectName}}</option>
									</select>
                                    <div class="parallel-btn">
                                        <button v-if="permission.query1" id='searchBtn' class="btn" v-on:click="queryDfpList">查询</button>
                                        <button v-if="permission.batchDistribution" class="btn" v-on:click="showBatchDistribution">批量分配</button>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="table-responsive bor-l bor-r">
                    <table id="wfpTable" class="table table-striped table-bordered min-width-1150">
                        <thead>
                            <tr>
                                <th width="5%"><input type="checkbox" id="allOrNoCheck" v-on:click="allCheck"></th>
                                <!-- <th width="10%">序号</th> -->
                                 <th width="10%">操作</th>
                                <th width="10%">客户名称</th>
                                <th width="10%">联系电话</th>
                                <th width="10%">获取途径</th>
                                <th width="15%">最后跟进内容</th>
                                <th width="15%">最后跟进时间</th>
                                <th width="10%">创建人</th>
                                <th width="15%">创建时间</th>
                               
                            </tr>
                        </thead>
                        <tbody>
                        	<tr v-for="(row,index) in dfpList">
                        		<td><label><input type='checkbox' name='checkbox' class='ace' v-bind:value='row.id'><span class='lbl'></span></label></td>
                        		<td><a href="javascript:;" class="operationBtn" v-if="permission.distribution"  v-on:click="showDistribution(row.id)">分配</a></td>
                        		<td>{{row.userName }}</td>
                        		<td>{{row.phone }}</td>
                        		<td>{{row.source }}</td>
                        		<td>
                        			<span class="contentSet" v-if="row.customerStatusName != null ">
		                        		关注问题：{{row.customerStatusName }}<br/>
		                        	</span>
		                        	<span class="contentSet2" v-if="row.remark != null">
		                        		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备注：{{row.remark}}<br/>
		                        	</span>
		                        	<span class="contentSet3" v-if="row.visitTime != null">
		                        		到访时间：{{row.visitTime  | moment}}
	                        		</span>
                        		</td>
                        		<td>{{row.lastCallTime  | moment}}</td>
                        		<td>{{row.createUserName }}</td>
                        		<td>{{row.createTime  | moment}}</td>
                        		
                        	</tr>
                        </tbody>
                    </table>
                    
                    
                </div>
                <div id="pagination_dfp">
				</div>
            </li>
        </ul>
        
        <div class="modal fade" id="myModalTwo" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                      <h4 class="modal-title" id="myModalLabel">分配</h4>
                    </div>
                    <div class="modal-body">
                        <div class="modal-eject">
                            <div class="form-group">
                                <label for="" class="col-sm-3 control-label"><span class="required">*</span>销售组名称：</label>
                                <div class="col-sm-9">
                                    <select class="form-control" v-model="distribution.saleGroupId">
                                        <option value="">请选择</option>
                                        <option v-for="saleGroup in saleGroupList"  v-bind:value="saleGroup.id">{{saleGroup.name}}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="" class="col-sm-3 control-label"><span class="required">*</span>经济人：</label>
                                <div class="col-sm-9">
                                    <select class="form-control" v-model="distribution.customerId">
                                        <option value="">请选择</option>
                                        <option v-for="agent in agentList" v-bind:value="agent.id">{{agent.userName}}</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                      <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                      <button type="button" class="btn checkedBtn" v-on:click="saveDistribution">确定</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="${contextPath}/static/optimization/js/customer/distribution/list.js?v=${jsVersion}"></script>
</body>

</html>
